<?php
session_start();
/**
* @package		ReservatieComponent voor ouderavonden van Atheneum Alicebourg Lanaken.
* @copyright	Copyright (C) 2008 Kristof Beckers. All rights reserved.
* @Version		1.0
* @license		GNU/GPL, see LICENSE.php
**/
include ("../../include/header.php");
?>

<head>
<link rel="stylesheet" href="../../css/template_css.css" type="text/css"/> 
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}

function submitForm(graad){
document.all.change_record.innerHTML = document.record.innerHTML + "<input type=hidden name=graad value='" + graad +"'>";
document.change_record.submit();
}
//-->
</script>

</head>
<body>
<div align="center"><img src="<?php echo "../$logo" ; ?>" /><br><br>
<a href="../index.php"/><img src="<?php echo "../$home" ; ?>" border="0"/></a><br><br>


<p>
  <?php 

include ("../../include/config.php");
require_once ("../../include/db.php");
include ("../../include/header.php");

if(isset($_SESSION['myusername'])){
	if ($_SESSION['admin'] == "$adminid") {

$klas = $_GET['klas'];

	echo"
	<div>  <br><br> </div>
	<form id='form1' name='form1' method='post' action='opdrachten_process.php'>
<table border='0' class='moduletable-latest'>
  <tr>
    <td width='10%'>Leerkrachtnaam</td>
    <td><input type='text' name='LKnaam' id='LKnaam' /></td>
  </tr>
  <tr>
    <td>LeerkrachtID</td>
    <td><input type='text' name='LKID' id='LKID' /></td>
  </tr>
  <tr>
    <td>Klastitularis</td>
    <td><select name='Klastitularis' id='Klastitularis'>
      <option value='Ja'>Ja</option>
      <option value='Nee'>Nee</option>
    </select>    </td>
  </tr>
  <tr>
    <td>Klas</td>
    <td><input type='text' name='Klas' id='Klas' /></td>
  </tr>
  <tr>
    <td>Vak</td>
    <td><input type='text' name='Vak' id='Vak' /></td>
  </tr>
  <tr>
    <td>Lokaal</td>
    <td><input type='text' name='Lokaal' id='Lokaal' /></td>
  </tr>
  <tr>
    <td><input type='submit' name='button' id='button' value='Verstuur' /></td>
    <td>&nbsp;</td>
  </tr>
</table>
</form><hr>";

?>
Selecteer een klas <br />


<form name="form1">

  <p>
  <!--<a name="graad" href="?graad=1" onClick="submitForm('1');">Eerste Graad</a><br />
<a name="graad" href="?graad=2" onClick="submitForm('2');">Tweede Graad</a><br />
<a name="graad" href="?graad=3" onClick="submitForm('3');">Derde Graad</a><br />

<!--<a name="graad" href="javascript:void(1);" onClick="submitForm('1');">Eerste Graad</a><br />
<a name="graad" href="javascript:void(1);" onClick="submitForm('2');">Tweede Graad</a><br />
<a name="graad" href="javascript:void(1);" onClick="submitForm('3');">Derde Graad</a><br />
-->
  <br>
    </p>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>1ste jaar </td>
      <td>2de jaar </td>
      <td>3de jaar </td>
      <td>4de jaar </td>
      <td>5de jaar </td>
      <td>6de jaar </td>
      <td>7de jaar </td>
    </tr>
    <tr>
      <td><select name="select" onChange="MM_jumpMenu('parent',this,0)">
        <?php 
//$graad = $_GET['graad'];


$sql12 = "SELECT DISTINCT Klas FROM $tbvak WHERE Klas like '1%' ORDER BY Klas ASC";
$result12=mysql_query($sql12);


?>
        <option></option>
        <option value="?klas=alles">Iedereen</option>
        <?php
while ($row12 = mysql_fetch_array($result12)) {
   $klas12 = $row12['Klas'];
   ?>
        <option value="?klas=<?php echo $klas12 ; ?>"><?php echo $klas12 ; ?></option>
        <?php } ?>
      </select></td>
      <td><select name="select2" onChange="MM_jumpMenu('parent',this,0)">
        <?php 
//$graad = $_GET['graad'];


$sql12 = "SELECT DISTINCT Klas FROM $tbvak WHERE Klas like '2%' ORDER BY Klas ASC";
$result12=mysql_query($sql12);


?>
        <option></option>
        <option value="?klas=alles">Iedereen</option>
        <?php
while ($row12 = mysql_fetch_array($result12)) {
   $klas12 = $row12['Klas'];
   ?>
        <option value="?klas=<?php echo $klas12 ; ?>"><?php echo $klas12 ; ?></option>
        <?php } ?>
      </select></td>
      <td><select name="select3" onChange="MM_jumpMenu('parent',this,0)">
        <?php 
//$graad = $_GET['graad'];


$sql12 = "SELECT DISTINCT Klas FROM $tbvak WHERE Klas like '3%' ORDER BY Klas ASC";
$result12=mysql_query($sql12);


?>
        <option></option>
        <option value="?klas=alles">Iedereen</option>
        <?php
while ($row12 = mysql_fetch_array($result12)) {
   $klas12 = $row12['Klas'];
   ?>
        <option value="?klas=<?php echo $klas12 ; ?>"><?php echo $klas12 ; ?></option>
        <?php } ?>
      </select></td>
      <td><select name="select4" onChange="MM_jumpMenu('parent',this,0)">
        <?php 
//$graad = $_GET['graad'];


$sql12 = "SELECT DISTINCT Klas FROM $tbvak WHERE Klas like '4%' ORDER BY Klas ASC";
$result12=mysql_query($sql12);


?>
        <option></option>
        <option value="?klas=alles">Iedereen</option>
        <?php
while ($row12 = mysql_fetch_array($result12)) {
   $klas12 = $row12['Klas'];
   ?>
        <option value="?klas=<?php echo $klas12 ; ?>"><?php echo $klas12 ; ?></option>
        <?php } ?>
      </select></td>
      <td><select name="select5" onChange="MM_jumpMenu('parent',this,0)">
        <?php 
//$graad = $_GET['graad'];


$sql12 = "SELECT DISTINCT Klas FROM $tbvak WHERE Klas like '5%' ORDER BY Klas ASC";
$result12=mysql_query($sql12);


?>
        <option></option>
        <option value="?klas=alles">Iedereen</option>
        <?php
while ($row12 = mysql_fetch_array($result12)) {
   $klas12 = $row12['Klas'];
   ?>
        <option value="?klas=<?php echo $klas12 ; ?>"><?php echo $klas12 ; ?></option>
        <?php } ?>
      </select></td>
      <td><select name="select6" onChange="MM_jumpMenu('parent',this,0)">
        <?php 
//$graad = $_GET['graad'];


$sql12 = "SELECT DISTINCT Klas FROM $tbvak WHERE Klas like '6%' ORDER BY Klas ASC";
$result12=mysql_query($sql12);


?>
        <option></option>
        <option value="?klas=alles">Iedereen</option>
        <?php
while ($row12 = mysql_fetch_array($result12)) {
   $klas12 = $row12['Klas'];
   ?>
        <option value="?klas=<?php echo $klas12 ; ?>"><?php echo $klas12 ; ?></option>
        <?php } ?>
      </select></td>
      <td><select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
        <?php 
//$graad = $_GET['graad'];


$sql12 = "SELECT DISTINCT Klas FROM $tbvak WHERE Klas like '7%' ORDER BY Klas ASC";
$result12=mysql_query($sql12);


?>
        <option></option>
        <option value="?klas=alles">Iedereen</option>
        <?php
while ($row12 = mysql_fetch_array($result12)) {
   $klas12 = $row12['Klas'];
   ?>
        <option value="?klas=<?php echo $klas12 ; ?>"><?php echo $klas12 ; ?></option>
        <?php } ?>
      </select></td>
    </tr>
  </table>
  <p>&nbsp;</p>
</form>
<p>
<p>Pas &eacute;&eacute;n van de volgende records aan:</p>
<table border="0" class='moduletable-latest1'>
    <tr>
    <td><?php echo "ID" ; ?></td>
    <td><?php echo "Klas" ; ?></td>
    <td><?php echo "Vak" ; ?></td>
    <td><?php echo "LeerkrachtID" ; ?></td>
    <td><?php echo "Leerkrachtnaam" ; ?></td>
    <td><?php echo "Klastitularis" ; ?></td>
    <td><?php echo "Lokaal" ; ?></td>
</tr>
</table>
  
<?php
if ($klas == 'alles'){
$sql = "SELECT * FROM $tbvak ORDER BY Klas ";
$result=mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
   $id =  $row['OpdrachtID'];  
   $klas = $row['Klas'];
   $vak = $row['Vak'];
   $lkid = $row['LeerkrachtID'];
   $lknaam = $row['Leerkrachtnaam'];
   $ktit = $row['Klastitularis'];
   $lok = $row['Lokaal'];
?>
<table  border="0" class='moduletable-latest1'>
 <tr>
    <td><?php echo "<a href='vak_edit.php?id=$id'>$id</a>" ; ?></td>
    <td><?php echo "$klas" ; ?></td>
    <td><?php echo "$vak" ; ?></td>
    <td><?php echo "$lkid" ; ?></td>
    <td><?php echo "$lknaam" ; ?></td>
    <td><?php echo "$ktit" ; ?></td>
    <td><?php echo "$lok" ; ?></td>
  </tr>
</table>
<?php
}}
if ($klas !== "" ){
$sql = "SELECT * FROM $tbvak WHERE Klas='$klas' ORDER BY Klastitularis ";
$result=mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
   $id =  $row['OpdrachtID'];  
   $klas = $row['Klas'];
   $vak = $row['Vak'];
   $lkid = $row['LeerkrachtID'];
   $lknaam = $row['Leerkrachtnaam'];
   $ktit = $row['Klastitularis'];
   $lok = $row['Lokaal'];
?>
<table  border="0" class='moduletable-latest1'>
 <tr>
    <td><?php echo "<a href='vak_edit.php?id=$id'>$id</a>" ; ?></td>
    <td><?php echo "$klas" ; ?></td>
    <td><?php echo "$vak" ; ?></td>
    <td><?php echo "$lkid" ; ?></td>
    <td><?php echo "$lknaam" ; ?></td>
    <td><?php echo "$ktit" ; ?></td>
    <td><?php echo "$lok" ; ?></td>
  </tr>
</table>
<?php
}}
  
  }}
  else {
  header("location:../index.php");
  }
  ?>

</div>
</body>
